const md5password = require('../utils/password')

// 密码加密
const handlePassword = async (ctx, next) => {
  const { password } = ctx.request.body
  if (!password) {
    ctx.throw(500, "密码不能为空")
  }
  ctx.request.body.password = md5password(password)
  await next()
}

module.exports = {
  handlePassword
}
